﻿using Acme.BookStore.Lodgings;
using AutoMapper.Internal.Mappers;
using Microsoft.AspNetCore.Mvc;
using SC.UserCenter.Infra;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace Acme.BookStore.HousingPriceplan
{



    /// <summary>
    /// This is the HousingAdd class.
    /// </summary>
    /// 
    [ApiExplorerSettings(GroupName = "v2")]
    public class HousingAdd: ApplicationService,IHousingAdd
    {

        IRepository<RatePlans> _RatePlansReservationsrepository;

        public HousingAdd(IRepository<RatePlans> ratePlansReservationsrepository)
        {
            _RatePlansReservationsrepository = ratePlansReservationsrepository;
        }
        /// <summary>
        /// 房价计划新增
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult> RatePlansAdd(IHousingAddDTO dto)
        {
            var list = ObjectMapper.Map<IHousingAddDTO, RatePlans>(dto);
            await _RatePlansReservationsrepository.InsertAsync(list);
            return ApiResult.Ok(list);
        }
    }
}
